package com.meetingshow.action.meeting;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.meetingshow.action.MeetingShowAction;
import com.meetingshow.form.meeting.MeetingForm;
import com.meetingshow.service.meeting.IMeetingSVC;
import com.meetingshow.utils.UIServiceFactory;

public class AddMeetingAction extends MeetingShowAction {
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse res)
			throws Exception {
		Logger logger = Logger.getLogger(AddMeetingAction.class);
		logger.info("AddMeetingAction");
		
		try {
			MeetingForm meetingForm = (MeetingForm)form;
			IMeetingSVC meetingSVC = UIServiceFactory.getMeetingSVC();
			meetingSVC.addMeeting(meetingForm.getName(), meetingForm.getName_en(), meetingForm.getStart_date(), meetingForm.getEnd_date(), meetingForm.getType(),
					meetingForm.getDistrict(), meetingForm.getLocation(), meetingForm.getAbstracts(), meetingForm.getIndustry(), meetingForm.getOrganizer(), 
					meetingForm.getSponsor(), meetingForm.getCo_organizer(), meetingForm.getContact(), meetingForm.getContact_phone(), meetingForm.getContact_fax(), 
					meetingForm.getEmail(), meetingForm.getWebsite(), meetingForm.getCharge(), meetingForm.getPopular(), meetingForm.getLevel(), 
					meetingForm.getValue());
			res.getWriter().print(meetingForm.getName() + "  添加成功 ! <a href='../meetingMg.jsp'>返回管理页面</a>&nbsp;&nbsp;&nbsp;<a href='javascript:windows.close()')关闭页面</a>");
			System.out.println("Meeting add Successfully-CONFIRM");
		
		} catch (Exception e) {
			logger.error(e.toString());
			res.getWriter().println(e.toString());
		}
		return null;
	}
}
